﻿using JinYuan.MES.Enums;
using JinYuan.MES.Models;
using JinYuan.Models;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JinYuan.MES
{
    /// <summary>
    /// MES接口
    /// </summary>
    public interface IMes
    {
        /// <summary>
        /// 登录接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="userName"></param>
        /// <param name="passWord"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool LoginEnyity(string url, string siteCode, string lineCode, string equipNum, string userName, string passWord, string UserCardID, ref string resJson);
        /// <summary>
        /// 设备参数设定值请求接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="equipNum"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="resJson"></param>
        /// <returns></returns>
        ParamReturnData GetParamSetRequest(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, ref string resJson);

        /// <summary>
        /// 参数设定值变更接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="paramChangeItems"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool ParamChange(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<TagListItem> paramChangeItems, ref string resJson);

        /// <summary>
        /// 单个上传（只上传条码，不上传卷芯码）
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="BarCode"></param>
        /// <param name="resJson"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        bool SingleCellInStation(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, string BarCode, ref string MesMessage, ref MesResType mesResType);



        /// <summary>
        /// 复投单个上传（只上传条码，不上传卷芯码）
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="BarCode"></param>
        /// <param name="resJson"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        bool SingleFTCellInStation(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, string BarCode, ref string MesMessage, ref MesResType mesResType);

        /// <summary>
        /// 电芯进站接口(多个)
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="code"></param>
        /// <param name="scanRes"></param>
        /// <param name="msg"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        bool ManyCellInStation(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<string> listBar, ref List<string> MesMessage, ref List<MesResType> mesResType);

        /// <summary>
        /// 电芯进站接口(多个)
        /// </summary>
        /// <param name="list"></param>
        /// <param name="isWeldingSpotlssue"></param>
        /// <param name="MesMessage"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        bool OutboundInformations(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, BGearEntity listBar, ref string MesMessage, ref MesResType mesResType, List<string> NGcodeList,List<string> ngMessage);


        /// <summary>
        /// 产品过程加工参数接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="userName"></param>
        /// <param name="equipNum"></param>
        /// <param name="lineCode"></param>
        /// <param name="materialCode"></param>
        /// <param name="unloadType"></param>
        /// <param name="productProcessParam"></param>
        /// <param name="resJson"></param>
        /// <returns></returns>
        bool ProductProcessParam(string url, string siteCode, string userName, string equipNum, string lineCode, string materialCode, MesUploadType unloadType, List<ProductProcessParam> productProcessParam, ref string resJson);

        /// <summary>
        /// 产品结果加工参数接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="equipNum"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="userName"></param>
        /// <param name="materialCode"></param>
        /// <param name="tagDataVOListItem"></param>
        /// <param name="identificationListItem"></param>
        /// <param name="unloadType"></param>
        /// <param name="resJson"></param>
        /// <returns></returns>
        bool ProducResultParam(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, BGearEntity m, MesUploadType unloadType, ref string resJson);


        /// <summary>
        /// 单电芯出站
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="userName"></param>
        /// <param name="equipNum"></param>
        /// <param name="lineCode"></param>
        /// <param name="materialCode"></param>
        /// <param name="m"></param>
        /// <param name="type"></param>
        /// <param name="mesage"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        bool SingleCellOutStation(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, BGearEntity m, int type, string materialLotCodeLocator, ref string mesage, ref MesResType mesResType);

        /// <summary>
        /// 多电芯出站接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="userName"></param>
        /// <param name="equipNum"></param>
        /// <param name="lineCode"></param>
        /// <param name="materialCode"></param>
        /// <param name="cellOutStation"></param>
        /// <param name="type"></param>
        /// <param name="resJson"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        //bool ManyCellOutStation(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<BGearEntity> m, int type, string materialLotCodeLocator, ref List<string> MesMessage, ref List<MesResType> mesResType);

        /// <summary>
        /// 设备运行状态接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="equipNum"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="statusCode"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="faultCodes"></param>
        /// <param name="guid"></param>
        /// <param name="resJson"></param>
        /// <returns></returns>
        bool UploadEquStatus(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, string guid, string statusCode, List<FaultCodeList> faultCodes, ref string resJson);


        /// <summary>
        /// 设备报警接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="equipNum"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="userName"></param>
        /// <param name="materialCode"></param>
        /// <param name="alarmLineListItem"></param>
        /// <param name="guid"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool UploadEquAlarm(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<AlarmData> alarmObj, string guid, ref string msg);

        /// <summary>
        /// 能耗数据上传
        /// </summary>
        /// <param name="url"></param>
        /// <param name="equipNum"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="userName"></param>
        /// <param name="electricMeterNum"></param>
        /// <param name="wattrs"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool UploadEquEnergy(string url, string siteCode, string lineCode, string equipNum, string userName, List<string> electricMeterNum, List<WattrMeter> wattrs, ref string msg);

        /// <summary>
        /// 风速仪数据上传
        /// </summary>
        /// <param name="url"></param>
        /// <param name="equipNum"></param>
        /// <param name="antiDustAirSpeedNum"></param>
        /// <param name="collectData"></param>
        /// <param name="resJson"></param>
        /// <returns></returns>
        bool UploadDeviceCollectData(string url, string equipNum, List<string> antiDustAirSpeedNum, List<float> collectData, ref string msg);

        /// <summary>
        /// MES分档接口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="barCode"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="userName"></param>
        /// <param name="equipCode"></param>
        /// <param name="materialCode"></param>
        /// <returns></returns>
        (bool Success, List<string> MesMessage, List<string> MesResType, List<string> mesResFangAnType) MesGrading(
       string url, string barCode, string siteCode, string lineCode, string userName, string equipCode, string materialCode);
    }
}
